package com.qingcheng.controller;


import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 获取登录名
 */
@RestController
@RequestMapping("/login")
public class LoginController {


    @RequestMapping("login")
    public Map Login(){

        String name = SecurityContextHolder.getContext().getAuthentication().getName();
        Map map = new HashMap();
        map.put("name",name);

        return map;

    }

}
